package com.cyx.system.controller.user;

import com.cyx.common.core.controller.BaseController;
import com.cyx.common.core.domain.R;
import com.cyx.common.core.domain.TableDataInfo;
import com.cyx.system.domain.user.dto.UserDTO;
import com.cyx.system.domain.user.dto.UserQueryDTO;
import com.cyx.system.service.user.IUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@Tag(name = "用户管理接口")
public class UserController extends BaseController {

    @Autowired
    private IUserService userService;

    @Operation(description = "用户列表")
    @GetMapping("/list")
    public TableDataInfo list(UserQueryDTO userQueryDTO) {
        return getTableDataInfo(userService.list(userQueryDTO));
    }

    @Operation(description = "更新用户状态")
    @PutMapping("/updateStatus")
    // TODO 拉黑：限制用户操作  解禁：放开对用户的限制
    // 更新用户状态信息
    public R<Void> updateStatus(@RequestBody UserDTO userDTO) {
        return toR(userService.updateStatus(userDTO));
    }
}
